#include "widget.h"
#include "ui_widget.h"
#include "jsgauge.h"
#include "translator.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    m_gauge = new JsGauge(this);
    ui->stackedWidget->addWidget(m_gauge);
    ui->stackedWidget->setCurrentWidget(m_gauge);
    setMinimumSize(QSize(500, 500));

    connect(m_gauge->translator(), SIGNAL(receiveJsValue(int)), this, SLOT(onReceiveJsValue(int)));
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_spinBox_valueChanged(int arg1)
{
    m_gauge->setValue(arg1);
}

void Widget::onReceiveJsValue(int value)
{
    ui->spinBox->setValue(value);
}
